// 1.算法题：https://leetcode-cn.com/problems/maximum-depth-of-binary-tree

/**
 * Definition for a binary tree node.
 * function TreeNode(val, left, right) {
 *     this.val = (val===undefined ? 0 : val)
 *     this.left = (left===undefined ? null : left)
 *     this.right = (right===undefined ? null : right)
 * }
 */
/**
 * @param {TreeNode} root
 * @return {number}
 */
 var maxDepth = function (root) {
    if (!root) {
        return 0;
    }else{
        const left = maxDepth(root.left);
        const right = maxDepth(root.right);
        return Math.max(left,right)+1
    }
};

// 2.手写题：https://bigfrontend.dev/zh/problem/immerjs
